#ifndef __DATACPY_H__
#define __DATACPY_H__

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define START			(true)
#define STOP			(true)
#define COMPLETED		(true)
#define UNCOMPLETED		(true)

#define RUNING			(true)

#define ISVSD			(true)	// 变频
#define FULLSPEED		(true)	// 满频运行

#define NORMAL			(false)
#define ALARM			(true)

#define INVALID_DEVICEKEY	(0xffffffff)

#define CHANGED			(true)

typedef char ARRAY128[128];

/* 在添加设备时，将所有订阅的实点的topic保存到ptr指向的内存 */
struct _dk_repo{
	int num;		// ptr指向的内存中有几个ARRAY128长度
	ARRAY128 *ptr;
};

enum season{
	Winter = 1,
	Summer,
	Transition
};

enum cmd_oper{
	Cmd_Write,
	Cmd_Read,
};

enum type_of_val{
	TypeOfVal_BOOL,
	TypeOfVal_INT,
	TypeOfVal_CHAR,
	TypeOfVal_STRING,
	TypeOfVal_DOUBLE
};

enum error_code{
	ErrFalse = -100,
	ErrNoJsonObj,
	ErrNoDev,
	ErrNoExist,
	ErrExist,
	Success = 0
};

typedef union _data_type_u{
	bool		b;
	int 		i;
	char		c;
	double		d;
	char		s[30];
}data_type_u;

/* 单个点位的属性描述符 */
typedef struct _point_prop_t{
	char name[30];

	// 决定Val的类型：enum type_of_val
	enum type_of_val	tag;
	data_type_u			val;

	char dev_key[30];
	char func[30];

}point_prop_t;

#endif //__DATACPY_H__